
SUBDIRS = . 

CSC = gmcs

WRAPPER = tomboy
TARGET = $(WRAPPER).exe

if FIXED_GTKSPELL
FIXED_GTKSPELL_CSFLAGS = -define:FIXED_GTKSPELL
endif

CSFLAGS = 				\
	-debug				\
	-define:DEBUG 		\
	-define:MAEMO 		\
	-unsafe 			\
	-target:exe 			\
	$(FIXED_GTKSPELL_CSFLAGS)

CSFILES = 					    \
	$(srcdir)/Tomboy.cs 		\
	$(srcdir)/NoteWindow.cs     \
	$(srcdir)/ToCWindow.cs      \
	\
	$(srcdir)/TomboyDataProvider/TomboyDataProvider.cs     \
	$(srcdir)/TomboyDataProvider/TomboyDataProviderFile.cs \
	$(srcdir)/TomboyDataProvider/TomboyProviderLoader.cs   \
	\
	$(srcdir)/Stubs/GConf.cs 			\
	$(srcdir)/Stubs/Gnome.Url.cs 		\
	\
	$(srcdir)/Tomboy/Logger.cs			\
	$(srcdir)/Tomboy/Note.cs 			\
	$(srcdir)/Tomboy/NoteBuffer.cs 		\
	$(srcdir)/Tomboy/NoteEditor.cs 		\
	$(srcdir)/Tomboy/NoteManager.cs 	\
	$(srcdir)/Tomboy/NoteTag.cs 		\
	$(srcdir)/Tomboy/PluginManager.cs	\
	$(srcdir)/Tomboy/Preferences.cs		\
	$(srcdir)/Tomboy/Tag.cs				\
	$(srcdir)/Tomboy/Trie.cs			\
	$(srcdir)/Tomboy/TagManager.cs		\
	$(srcdir)/Tomboy/Utils.cs 			\
	$(srcdir)/Tomboy/Undo.cs			\
	$(srcdir)/Tomboy/Watchers.cs

#	$(srcdir)/Tomboy/Tomboy.cs 			\
#	$(srcdir)/Tomboy/ActionManager.cs		\
#	$(srcdir)/Tomboy/Applet.cs 			\
#	$(srcdir)/Tomboy/Logger.cs			\
#	$(srcdir)/Tomboy/Note.cs 			\
#	$(srcdir)/Tomboy/NoteManager.cs 		\
#	$(srcdir)/Tomboy/NoteWindow.cs 		\
#	$(srcdir)/Tomboy/NoteBuffer.cs 		\
#	$(srcdir)/Tomboy/NoteTag.cs 			\
#	$(srcdir)/Tomboy/PluginManager.cs		\
#	$(srcdir)/Tomboy/Preferences.cs		\
#	$(srcdir)/Tomboy/RecentChanges.cs		\
#	$(srcdir)/Tomboy/Tag.cs				\
#	$(srcdir)/Tomboy/TagButton.cs			\
#	$(srcdir)/Tomboy/TagManager.cs			\
#	$(srcdir)/Tomboy/Tray.cs 			\
#	$(srcdir)/Tomboy/Trie.cs			\
#	$(srcdir)/Tomboy/Undo.cs 			\
#	$(srcdir)/Tomboy/Utils.cs			\
#	$(srcdir)/Tomboy/Watchers.cs			\
#	$(srcdir)/Tomboy/WrapBox.cs			\
#	$(srcdir)/Tomboy/XKeybinder.cs


ASSEMBLIES = 		\
	$(TOMBOY_LIBS) 	\
	$(GTK_SHARP_20_LIBS) 	\
	$(MAEMO_SHARP_LIBS) 	\
	-r:Mono.Posix

RESOURCES =	\
	-resource:$(top_srcdir)/data/pixmaps/tomboy.png,tomboy.png


$(TARGET): $(CSFILES) Defines.cs
	$(CSC) -out:$@ $(CSFLAGS) $^ $(ASSEMBLIES) $(RESOURCES)

tomboylibdir = $(pkglibdir)
tomboylib_DATA = $(TARGET) $(TARGET).config


bin_SCRIPTS = $(WRAPPER)

$(WRAPPER): $(srcdir)/$(WRAPPER).in Makefile
	sed -e "s|\@prefix\@|$(prefix)|g" 		\
	    -e "s|\@pkglibdir\@|$(pkglibdir)|g" 	\
	    -e "s|\@bindir\@|$(bindir)|g"		\
	    -e "s|\@target\@|$(TARGET)|g" 		\
	    -e "s|\@wrapper\@|$(WRAPPER)|g"		\
	    -e "s|\@extragac\@|$(EXTRA_GAC_PREFIX)|g"	\
	    -e "s|\@srcdir\@|$(PWD)|g"	\
	    < $< > $@
	chmod +x $(WRAPPER)

$(TARGET).config: $(srcdir)/$(TARGET).config.in Makefile
	sed -e "s|\@pkglibdir\@|$(pkglibdir)|" \
	    < $< > $@

Defines.cs: $(srcdir)/Defines.cs.in Makefile
	sed -e "s|\@version\@|$(VERSION)|"     \
	    -e "s|\@datadir\@|$(datadir)|"     \
	    -e "s|\@pkglibdir\@|$(pkglibdir)|" \
	    < $< > $@

EXTRA_DIST =           		\
	$(CSFILES)      		\
	$(WRAPPER).in			\
	$(TARGET).config.in		\
	$(srcdir)/Defines.cs.in	

CLEANFILES =			\
	$(TARGET) 		\
	$(TARGET).config	\
	$(TARGET).mdb 		\
	$(WRAPPER)		\
	Defines.cs

run: $(WRAPPER) $(TARGET)
	run-standalone.sh mono tomboy.exe
